package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.QueryString;
import com.itheima.entity.Result;
import com.itheima.service.OrderStatusService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("orderStatus")
public class OrderStatusController {

    @Reference
    private OrderStatusService orderStatusService;

    //分页查询
    @RequestMapping("findPage")
    //返回分页结果
    public PageResult findPage(@RequestBody QueryString queryString){
        return orderStatusService.findPage(queryString);
    }
    //根据order表id删除
    @RequestMapping("delete")
    public Result delete(Integer id){
        try {
            orderStatusService.deleteById(id);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.DELETE_CHECKITEM_FAIL);
        }
        return new Result(true, MessageConstant.DELETE_CHECKITEM_SUCCESS);
    }
}
